﻿using Comm;
using JGMelLib.JGMesService;
using JGMelLib.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JGMelLib
{
    public static class MesHelper
    { 
        public  static Resp GetWorkNoList(string processid,string deviceNo)
        {
            try
            {


                var client = new JGWebServiceSoapClient();
                client.InnerChannel.OperationTimeout = new TimeSpan(0, 0, 7);

                Logger.Info($"【获取工单列表】 请求 工序:{processid} 设备编号:{deviceNo}");
                var rspStr = client.List_WorkOrder(processid, deviceNo);
                Logger.Info($"【获取工单列表】 返回:工序:{processid} 设备编号:{deviceNo} 结果:{rspStr}");
                var rsp = JsonConvert.DeserializeObject<Resp>(rspStr);


                return rsp;

            }catch(Exception ex)
            {
                Logger.Error($"【获取工单列表】 发生异常:{processid} 设备编号:{deviceNo} {ex.Message}");
                return null;
            }
        }
    }
}
